﻿using com.iot.core.annotation;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Linq;

namespace com.iot.core.data.entity
{
    [Schema(Name = "在线用户表", Description = "")]     
    public class HtUserLogin : BaseEntity
    {




        [Comment("Token")]
        [Schema(Name = "Token", Description = "")]
        [Required(ErrorMessage = "{0}不能为空")]
        [MaxLength(50)]
        public string Token { get; set; } = "";


        [Comment("姓名")]
        [Schema(Name = "姓名", Description = "")]
        [Required(ErrorMessage = "{0}不能为空")]
        [MaxLength(50)]
        public string Name { get; set; } = "";


        [Comment("机构编码")]
        [Schema(Name = "机构编码", Description = "")]
        public long HtdeptId { get; set; }


        [Comment("机构名称")]
        [Schema(Name = "机构名称", Description = "")]
        [MaxLength(100)]
        public string HtdeptName { get; set; } = "";


        [Comment("角色数据")]
        [Schema(Name = "角色数据", Description = "BaseDto 数组,json格式")]
        [MaxLength(200)]
        public string HtroleData { get; set; } = "";


        [Comment("HTRoles")]
        [Schema(Name = "HTRoles", Description = "")]
        [NotMapped]
        public List<IdNameDto> Htroles { get; set; }=new List<IdNameDto>();


        [Comment("平台编号")]
        [Schema(Name = "平台编号", Description = "")]
        public long HtplatId { get; set; }


        [Comment("登录方式")]
        [Schema(Name = "登录方式", Description = "Appver、IMSI")]
        [MaxLength(10)]
        public string Loginway { get; set; } = "";


        [Comment("额外信息")]
        [Schema(Name = "额外信息", Description = "网站、小程序、安卓终端")]
        public string Extra { get; set; } = "";


        [Comment("IP")]
        [Schema(Name = "IP", Description = "")]
        [MaxLength(50)]
        public string Ip { get; set; } = "";


        [Comment("OS")]
        [Schema(Name = "OS", Description = "")]
        [MaxLength(50)]
        public string Os { get; set; } = "";


        [Comment("IMSI")]
        [Schema(Name = "IMSI", Description = "")]
        [MaxLength(50)]
        public string Imsi { get; set; } = "";


        [Comment("浏览器")]
        [Schema(Name = "浏览器", Description = "")]
        [MaxLength(50)]
        public string Browser { get; set; } = "";


        [Comment("App版本")]
        [Schema(Name = "App版本", Description = "")]
        [MaxLength(20)]
        public string Appver { get; set; } = "";


        [Comment("创建日期")]
        [Schema(Name = "创建日期", Description = "")]
        public DateTime CrtDt { get; set; } = DateTime.Now;


        [Comment("用户编号")]
        [Schema(Name = "用户编号", Description = "")]
        public long CrtUid { get; set; }


        [Comment("机构编号")]
        [Schema(Name = "机构编号", Description = "")]
        public long CrtDid { get; set; }


        [Comment("更新日期")]
        [Schema(Name = "更新日期", Description = "")]
        public DateTime EdtDt { get; set; } = DateTime.Now;


        [Comment("更新用户编号")]
        [Schema(Name = "更新用户编号", Description = "")]
        public long EdtUid { get; set; }


        [Comment("最近访问地址")]
        [Schema(Name = "最近访问地址", Description = "")]
        [MaxLength(20)]
        public string EdtUrl { get; set; } = "";


        [Comment("在线状态")]
        [Schema(Name = "在线状态", Description = "")]
        public bool Online { get; set; }


        [Comment("注销日期")]
        [Schema(Name = "注销日期", Description = "")]
        public DateTime LogoutDt { get; set; }


        [Comment("注销备注")]
        [Schema(Name = "注销备注", Description = "")]
        [MaxLength(100)]
        public string LogoutMemo { get; set; } = "";


        [Comment("是否调试")]
        [Schema(Name = "是否调试", Description = "")]
        public bool Debug { get; set; }
    }
}
